package cloudgamesaumysql

import (
	"github.com/shopspring/decimal"
	"gorm.io/gorm"
	"time"
)

/*
  @author liubogeng
  @date   2024/12/31 15:36
*/

// CGGameAUUserTransactionOfThirdParty 云游戏对接第三方（暂时只有劲舞团）的用户充值（订单）记录表
type CGGameAUUserTransactionOfThirdParty struct {
	ID                     int64           `json:"id" gorm:"column:id;type:bigint;primaryKey;autoIncrement;comment:ID"`
	TransactionOrderNumber string          `json:"transaction_order_number" gorm:"column:transaction_order_number;type:varchar(128);default:'';not null;comment:充值订单单号"`
	RechargeType           string          `json:"recharge_type" gorm:"column:recharge_type;type:varchar(32);default:'';not null;comment:充值类型，目前有 平台，劲舞团，直购"`
	TopUpPlatform          string          `json:"top_up_platform" gorm:"column:top_up_platform;type:varchar(32);not null;default:'';comment:充值平台，微信/支付宝"`
	UserID                 int64           `json:"user_id" gorm:"column:user_id;type:bigint;not null;default:0;comment:用户ID"`
	Phone                  string          `json:"phone" gorm:"column:phone;type:varchar(20);not null;default:'';comment:用户手机号"`
	Region                 string          `json:"region" gorm:"column:region;type:varchar(128);not null;default:'';comment:游戏区服"`
	TransactionAmount      decimal.Decimal `json:"transaction_amount" gorm:"column:transaction_amount;type:decimal(12,2);not null;default:0.00;comment:交易金额"`
	TransactionStatus      int             `json:"transaction_status" gorm:"column:transaction_status;type:tinyint;not null;default:0;comment:交易状态 0为待付款 1为已超时 2已取消 8已付款 9支付中 10已关闭"`
	PayingTime             time.Time       `json:"paying_time" gorm:"column:paying_time;type:datetime;default:null;comment:订单的交易状态转为 正在支付 的时间戳"`
	IsSendRequest          int             `json:"is_send_request" gorm:"column:is_send_request;type:tinyint;not null;default:0;comment:与第三方发送请求 0未发送 1已发送"`
	IsSynchronized         int             `json:"is_synchronized" gorm:"column:is_synchronized;type:tinyint;not null;default:0;comment:与第三方对接的同步状态 0未同步 1已同步"`
	SynchronizedTime       time.Time       `json:"synchronized_time" gorm:"column:synchronized_time;type:datetime;default:null;comment:与第三方对接的同步时间"`
	//CauseOfFailure    string         `json:"cause_of_failure" gorm:"column:cause_of_failure;type:varchar(500);not null;default:'';comment:交易失败原因"`
	IsRefund                  int             `json:"is_refund" gorm:"column:is_refund;type:tinyint;not null;default:0;comment:是否退款 0未退款 1部分退款 2全额退款"`
	RefundedTransactionAmount decimal.Decimal `json:"refunded_transaction_amount" gorm:"column:refunded_transaction_amount;type:decimal(12,2);not null;default:0.00;comment:已退款金额"`
	//CauseOfRefund string         `json:"cause_of_refund" gorm:"column:cause_of_refund;type:varchar(500);not null;default:'';comment:退款原因"`
	AbleRefundTransactionAmount           decimal.Decimal `json:"able_refund_transaction_amount" gorm:"column:able_refund_transaction_amount;type:decimal(12,2);not null;default:0.00;comment:可退款金额"`
	HitTheLimitUserRechargeFreeTimeAmount decimal.Decimal `json:"hit_the_limit_user_recharge_free_time_amount" gorm:"column:hit_the_limit_user_recharge_free_time_amount;type:decimal(12,2);not null;default:0.00;comment:命中的配置用户充值多少金额能够获得赠送的充值免费时长"`
	HitTheLimitUserGetRechargeFreeTime    int64           `json:"hit_the_limit_user_get_recharge_free_time" gorm:"column:hit_the_limit_user_get_recharge_free_time;type:bigint;not null;default:0;comment:命中的配置赠送用户多少充值免费时长"`
	//RefundTransactionAmount     decimal.Decimal `json:"refund_transaction_amount" gorm:"column:refund_transaction_amount;type:decimal(12,2);not null;default:0.00;comment:实际退款金额"`
	CreatedAt time.Time      `json:"created_at" gorm:"column:created_at;type:datetime;comment:该条记录创建时间"`
	UpdatedAt time.Time      `json:"updated_at" gorm:"column:updated_at;type:datetime;comment:该条记录修改时间"`
	DeletedAt gorm.DeletedAt `json:"-" gorm:"index;type:datetime;comment:该条记录删除时间"`
}

func (CGGameAUUserTransactionOfThirdParty) TableName() string {
	return "cg_game_au_user_transaction_of_third_party"
}
